﻿using System.Linq;
using Kele.Core.Mvc;
using Microsoft.AspNetCore.Mvc;

namespace Kele.Activity.Weixin.Controllers.V1
{
    [Route("[controller]")]

    public class MvcBaseController : ApiController
    {
        protected int merchant_id
        {
            get
            {
                var sid = User.Claims.First(claim => claim.Type == "merchant_id").Value;
                int.TryParse(sid, out var id);
                return id;
            }
        }

        protected string openid => User.Claims.First(claim => claim.Type == "openid").Value;
        protected string user_id => User.Claims.First(claim => claim.Type == "openid").Value;
    }
}